<template>
  <div class="article-item clearfix" @click.stop="tap2ArticleDetail(articleItemInfo.id,articleItemInfo.articleTitle)">
    <div class="item-left left">
      <div class="item-title">
        <template v-if="articleItemInfo.articleTitle.length > 30" >
          {{articleItemInfo.articleTitle.substring(0,30) + "..." }} 
        </template>
        <template v-else>{{ articleItemInfo.articleTitle }}</template>
      </div>
      <div class="item-icon-box" v-if="articleItemInfo.articleBrandName  ">
        <span class="item-icon">{{ articleItemInfo.articleBrandName }}</span>
      </div>
    </div>
    <div class="item-right right">
      <img :src="articleItemInfo.articleThumbnailsUrl" :alt="articleItemInfo.articleTitle" />
    </div>
  </div>
</template>

<script>
export default {
  name: "articleItem",
  props: {
    articleItemInfo: {
      type: Object,
      default: function() {
        return {};
      }
    }
  },
  computed: {},
  data() {
    return {};
  }, 
  methods: {
    tap2ArticleDetail(articleId, articleTitle ){ 
      if(this.$route.name == "articleListI"){ 
        this.$router.push({
          path: "/adIndex/articleDetailI",
          query: {
            articleId:articleId,
            articleTitle :articleTitle,
            shareUniqueId: window.localStorage.uniqueId
          }
        })
      }else{  
        this.$router.push({
          path: "/adIndex/articleDetail",
          query: {
            articleId:articleId,
            articleTitle :articleTitle,
            shareUniqueId: window.localStorage.uniqueId
          }
        })
      }
    }
  }
};
</script>
 
<style scoped lang="scss">
.article-item {
  width: 690px;
  height: auto;
  padding: 20px 0;
  margin: auto;
  position: relative;
  border-bottom: 1px solid rgba(241, 241, 241, 1);
  .item-left {
    width: 506px;
    height: auto;
    position: relative;
  }
  .item-right {
    width: 126px;
    height: 126px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
  }
  .item-right img {
    width: auto;
    height: 100%;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }
  .item-title {
    height: 126px;
    font-size: 34px;
    color: rgba(0, 0, 0, 1);
    line-height: 56px;
  }
  .item-icon-box {
    width: 100%;
    height: 40px;
    position: relative;
  }
  .item-icon {
    display: inline-block;
    width: auto;
    height: 38px;
    line-height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(102, 102, 102, 1);
    text-align: center;
    font-size: 24px;
    color: rgba(102, 102, 102, 1);
    padding: 0 12px;
    position: absolute;
    top: 0;
    left: 0;
  }
  .item-readtips {
    width: 100%;
    height: 39px;
    font-size: 26px;
    font-family: SourceHanSansCN-Regular;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 39px;
    position: absolute;
    bottom: 0;
    left: 0;
  }
  .item-readtips img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
  }
}
</style>
